<template>
  <div class="home">
    <h1>{{ $t('title') }}</h1>
    <div>
      <el-button @click="switchLanguage('en')" type="primary">英文</el-button>
      <el-button @click="switchLanguage('zh')" type="primary">中文</el-button>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'

export default {
  name: 'HomeView',
  components: {
    HelloWorld
  },
  methods: {
    switchLanguage(language) {
      this.$i18n.locale = language;
      localStorage.setItem('language', language);
    }
  }
}
</script>
